<template>
  <div id="warehouseInform">
    <el-row
      type="flex"
      justify="space-between"
      align="center"
      :gutter="20"
      style="width: 100%; margin-bottom: 10px"
    >
      <el-col
        :span="5"
        style="display: flex"
        ><span style="width: 60px; height: 40px; line-height: 40px">搜索：</span
        ><el-input
          placeholder="料仓名称"
          v-model="projectInput"
        ></el-input
      ></el-col>
      <el-col
        :span="7"
        style="display: flex"
        ><el-button
          type="primary"
          @click="searchHandler"
          >查询</el-button
        ><el-button
          plain
          @click="resetHandler"
          >重置</el-button
        ></el-col
      >
      <el-col
        :span="7"
        style="display: flex"
      ></el-col>
    </el-row>
    <el-row
      type="flex"
      justify="center"
      align="center"
      style="width: 100%; margin-bottom: 10px"
    >
      <el-col
        :span="2"
        style="display: flex"
        ><el-button
          type="primary"
          @click="addHandler"
          >新增</el-button
        >
        <el-button
          type="primary"
          @click="shuaxin"
          >刷新</el-button
        ></el-col
      >

      <el-col
        :span="20"
        style="display: flex"
      ></el-col>
      <el-col
        :span="2"
        :pull="1"
        style="display: flex"
      ></el-col>
    </el-row>
    <el-row>
      <el-table
        :data="renderData"
        border
        style="width: 100%"
        :header-cell-style="{ background: '#606266', color: '#fff' }"
        height="300"
      >
        <el-table-column
          type="index"
          label="序号"
          width="100"
          align="center"
        />
        <el-table-column
          prop="bdmc"
          label="标段名称"
          align="center"
          width="200"
        >
        </el-table-column>
        <el-table-column
          prop="pbbm"
          label="配比编码"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="pbmc"
          label="配比名称"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="glcz"
          label="关联场站"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="xzsj"
          label="新增时间"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="xzyh"
          label="新增用户"
          align="center"
        >
        </el-table-column>
        <el-table-column
          label="操作"
          width="180"
          align="center"
        >
          <template slot-scope="scope">
            <el-button
              type="text"
              @click="editHandler(scope.row)"
              >编辑</el-button
            >
            <el-button
              type="text"
              style="color: red"
              @click="deleteHandler(scope.row)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <el-row class="pagination">
        <el-pagination
          class="warehouseInformpagination1"
          background
          @size-change="handleSizeChangeONE"
          @current-change="handleCurrentChangeONE"
          :current-page="currentPageONE"
          :page-sizes="[10, 20, 50]"
          :page-size="10"
          layout="total, sizes, prev, pager, next, jumper"
          :total="totalONE"
        ></el-pagination>
      </el-row>
    </el-row>
    <el-row>
      <h1 class="warehouseInformH1">料仓扫描</h1>
      <div style="margin-bottom: 10px">
        <el-button
          type="primary"
          @click="addHandler2"
          >新增</el-button
        >
        <el-button
          type="primary"
          @click="shuaxin"
          >刷新</el-button
        >
      </div>

      <el-table
        :data="renderDataFour"
        border
        style="width: 100%"
        :header-cell-style="{ background: '#606266', color: '#fff' }"
        height="300"
      >
        <el-table-column
          type="index"
          label="序号"
          width="100"
          align="center"
        />
        <el-table-column
          prop="cwmc"
          label="仓位名称"
          align="center"
          width="200"
        >
        </el-table-column>
        <el-table-column
          prop="cllx"
          label="材料类型"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="clmc"
          label="材料名称"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="gg"
          label="规格"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="cwlx"
          label="仓位类型"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="cwxh"
          label="仓位序号"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="cwbh"
          label="仓位编号"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="cjzl"
          label="采集重量(t)"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="cjtj"
          label="采集体积(㎡)"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="cjsj"
          label="采集时间"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="wgdz"
          label="网关地址"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="wgid"
          label="网关ID"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="md"
          label="密度(g/c㎡)"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="ztj"
          label="总体积"
          align="center"
        >
        </el-table-column>
        <el-table-column
          label="操作"
          width="180"
          align="center"
        >
          <template slot-scope="scope">
            <el-button
              type="text"
              @click="editHandler(scope.row)"
              >编辑</el-button
            >
            <el-button
              type="text"
              style="color: red"
              @click="deleteHandler(scope.row)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </el-row>

    <el-row style="position: absolute; right: 50px">
      <el-pagination
        background
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[10, 20, 50]"
        :page-size="10"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </el-row>
    <!-- 编辑 -->
    <el-dialog
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :modal="false"
      :title="editTiele"
      :visible.sync="editDialogStatus"
      width="50%"
    >
      <el-form
        :model="from"
        ref="from"
        label-width="100px"
        class="demo-ruleForm"
      >
        <el-row class="mgb-10 from">
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="料仓名称:"
              prop="bdmc"
            >
              <el-input
                style="width: 150%"
                placeholder="料仓名称"
                v-model="from.pbbm"
              >
              </el-input>
            </el-form-item>
          </el-col>
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="经度:"
              prop="jd"
            >
              <el-input
                style="width: 150%"
                placeholder="经度"
                v-model="from.jd"
              >
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="mgb-10 from">
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="所属场站:"
              prop="sscz"
            >
              <el-select
                style="width: 140%"
                v-model="from.sscz"
                placeholder="关联场站"
              >
                <el-option
                  label="成都13号线一号站"
                  value="成都13号线一号站"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="纬度:"
              prop="wd"
            >
              <el-input
                style="width: 150%"
                placeholder="纬度"
                v-model="from.wd"
              >
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="mgb-10 from">
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="备注:"
              prop="bz"
            >
              <el-input
                style="width: 150%"
                placeholder="备注"
                v-model="from.bz"
              >
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-col
        :span="7"
        style="display: flex; margin-bottom: 1rem"
        ><el-button
          type="primary"
          @click="addDialogStatus = true"
          >新增</el-button
        ><el-button
          @click="deleteManage()"
          type="danger"
          >删除</el-button
        ></el-col
      >
      <el-col
        :span="7"
        style="display: flex"
      ></el-col>
      <el-table
        v-if="editTiele == '新增'"
        :data="renderDataTow"
        border
        style="width: 100%"
        :header-cell-style="{ background: '#606266', color: '#fff' }"
        height="400"
      >
        <el-table-column
          type="selection"
          width="55"
        >
        </el-table-column>
        <el-table-column
          prop="clbm"
          label="材料编码"
          align="center"
          width="200"
        >
        </el-table-column>
        <el-table-column
          prop="clmc"
          label="材料名称"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="ggxh"
          label="规格型号"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="jcclmc"
          label="进场材料名称"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="sdbl"
          label="设定比例"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="hsl"
          label="含水率"
          align="center"
        >
        </el-table-column>
      </el-table>
      <el-table
        v-if="editTiele == '编辑'"
        :data="renderDataTow"
        border
        style="width: 100%"
        :header-cell-style="{ background: '#606266', color: '#fff' }"
        height="400"
      >
        <el-table-column
          type="selection"
          width="55"
        >
        </el-table-column>
        <el-table-column
          prop="clbm"
          label="材料编码"
          align="center"
          width="200"
        >
        </el-table-column>
        <el-table-column
          prop="clmc"
          label="材料名称"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="ggxh"
          label="规格型号"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="jcclmc"
          label="进场材料名称"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="sdbl"
          label="设定比例"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="hsl"
          label="含水率"
          align="center"
        >
        </el-table-column>
      </el-table>
      <span
        v-if="editTiele == '编辑' || editTiele == '新增'"
        slot="footer"
        class="dialog-footer"
      >
        <el-button @click="editDialogStatus = false">取 消</el-button>
        <el-button
          type="primary"
          @click="editSaveHandler"
          >确 定</el-button
        >
      </span>
      <el-dialog
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        :title="editTiele"
        :visible.sync="addDialogStatus"
        width="60%"
        :append-to-body="true"
      >
        <el-form
          :model="from"
          ref="from"
          label-width="100px"
          class="demo-ruleForm"
        >
          <el-row class="mgb-10 from">
            <el-col
              :span="12"
              style="display: flex"
            >
              <el-form-item
                label="搜索:"
                prop="pbbm"
              >
                <el-input
                  style="width: 150%"
                  placeholder="品牌名称/规格型号/材料类型"
                  v-model="serchFrom.sousuo"
                >
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>

        <el-table
          :data="renderDataThree"
          border
          style="width: 100%"
          :header-cell-style="{ background: '#606266', color: '#fff' }"
          height="400"
        >
          <el-table-column
            type="selection"
            width="55"
          >
          </el-table-column>
          <el-table-column
            type="index"
            label="序号"
            width="100"
            align="center"
          />
          <el-table-column
            prop="cllx"
            label="材料类型"
            align="center"
            width="100"
          >
          </el-table-column>
          <el-table-column
            prop="ppmc"
            label="品牌名称"
            align="center"
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="clbm"
            label="材料编码"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="ggxh"
            label="规格型号"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="dw"
            label="单位"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="dj"
            label="单价"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="md"
            label="密度kg/m³"
            align="center"
            width="100"
          >
          </el-table-column>
          <el-table-column
            prop="shl"
            label="损耗率(%)"
            align="center"
            width="100"
          >
          </el-table-column>
          <el-table-column
            prop="hs"
            label="是否含水"
            align="center"
          >
          </el-table-column>

          <el-table-column
            prop="bz"
            label="备注"
            align="center"
          >
          </el-table-column>
        </el-table>
        <span
          slot="footer"
          class="dialog-footer"
        >
          <el-button @click="addDialogStatus = false">取 消</el-button>
          <el-button
            type="primary"
            @click="editSaveHandler"
            >确 定</el-button
          >
        </span>
      </el-dialog>
    </el-dialog>
    <el-dialog
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :title="editTiele"
      :visible.sync="addDialogStatus2"
      width="60%"
      :modal="false"
      class="addsiloScan"
    >
      <el-form
        :model="from2"
        ref="from"
        label-width="150px"
        class="demo-ruleForm"
      >
        <el-row class="mgb-10 from">
          <el-col
            :span="24"
            style="display: flex"
          >
            <el-form-item
              label="仓位名称:"
              prop="bdmc"
            >
              <el-input
                style="width: 150%"
                placeholder="仓位名称"
                v-model="from.pbbm"
              >
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="mgb-10 from">
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="仓位类型:"
              prop="glcz"
            >
              <el-select
                style="width: 140%"
                v-model="from.glcz"
                placeholder="仓位类型"
              >
                <el-option
                  label="钢筋班组"
                  value="钢筋班组"
                >
                </el-option>
                <el-option
                  label="水泥班组"
                  value="水泥班组"
                >
                </el-option>
                <el-option
                  label="轨道精调"
                  value="轨道精调"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="仓位编号:"
              prop="pbmc"
            >
              <el-input
                style="width: 150%"
                placeholder="仓位编号"
                v-model="from.cwbh"
              >
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="mgb-10 from">
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="仓位序列:"
              prop="cwxl"
            >
              <el-input-number
                v-model="from2.cwxl"
                :min="1"
                :max="10"
                label="0"
              ></el-input-number>
            </el-form-item>
          </el-col>
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="网关ID:"
              prop="wgid"
            >
              <el-input
                style="width: 150%"
                placeholder="网关ID"
                v-model="from.wgid"
              >
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="mgb-10 from">
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="网关地址:"
              prop="wgid"
            >
              <el-input
                style="width: 150%"
                placeholder="网关地址"
                v-model="from.wgid"
              >
              </el-input>
            </el-form-item>
          </el-col>
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="料仓高度:"
              prop="lcgd"
            >
              <el-input
                style="width: 150%"
                placeholder="料仓高度"
                v-model="from.lcgd"
              >
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="mgb-10 from">
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="半径:"
              prop="bj"
            >
              <el-input
                style="width: 150%"
                placeholder="半径"
                v-model="from.bj"
              >
              </el-input>
            </el-form-item>
          </el-col>
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="总体积(m³):"
              prop="lcgd"
            >
              <el-input
                style="width: 150%"
                placeholder="总体积(m³)"
                v-model="from.lcgd"
              >
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="mgb-10 from">
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="椎体高度(mm):"
              prop="ztgd"
            >
              <el-input
                style="width: 150%"
                placeholder="椎体高度"
                v-model="from.ztgd"
              >
              </el-input>
            </el-form-item>
          </el-col>
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="容器规格:"
              prop="rqgg"
            >
              <el-input
                style="width: 150%"
                placeholder="容器规格"
                v-model="from.rqgg"
              >
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="mgb-10 from">
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="材料密度(g/c立方米):"
              prop="clmd"
            >
              <el-input
                style="width: 150%"
                placeholder="材料密度"
                v-model="from.clmd"
              >
              </el-input>
            </el-form-item>
          </el-col>
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="点位设置:"
              prop="dwsz"
            >
              <el-input
                style="width: 150%"
                placeholder="点位设置"
                v-model="from.dwsz"
              >
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="mgb-10 from">
          <el-col
            :span="12"
            style="display: flex"
          >
            <el-form-item
              label="备注:"
              prop="bz"
            >
              <el-input
                style="width: 150%"
                placeholder="备注"
                v-model="from.bz"
              >
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <el-table
        :data="renderDataThree"
        border
        style="width: 100%"
        :header-cell-style="{ background: '#606266', color: '#fff' }"
        height="250"
      >
        <el-table-column
          type="selection"
          width="55"
        >
        </el-table-column>
        <el-table-column
          type="index"
          label="序号"
          width="100"
          align="center"
        />
        <el-table-column
          prop="cllx"
          label="材料类型"
          align="center"
          width="100"
        >
        </el-table-column>
        <el-table-column
          prop="ppmc"
          label="品牌名称"
          align="center"
          width="150"
        >
        </el-table-column>
        <el-table-column
          prop="clbm"
          label="材料编码"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="ggxh"
          label="规格型号"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="dw"
          label="单位"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="dj"
          label="单价"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="md"
          label="密度kg/m³"
          align="center"
          width="100"
        >
        </el-table-column>
        <el-table-column
          prop="shl"
          label="损耗率(%)"
          align="center"
          width="100"
        >
        </el-table-column>
        <el-table-column
          prop="hs"
          label="是否含水"
          align="center"
        >
        </el-table-column>

        <el-table-column
          prop="bz"
          label="备注"
          align="center"
        >
        </el-table-column>
      </el-table>
      <span
        slot="footer"
        class="dialog-footer"
      >
        <el-button @click="addDialogStatus2 = false">取 消</el-button>
        <el-button
          type="primary"
          @click="addDialogStatus2 = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>

<script>
// import {
//   getProjectList,
//   projectDetail,
//   addProject,
//   updateProject,
//   deleteProject,
// } from "../../../http/projectMg.js";
export default {
  data() {
    return {
      dialogVisible: false,
      projectInput: '',
      renderData: [],
      renderDataTow: [],
      renderDataThree: [],
      renderDataFour: [],
      total: 0,
      pageSize: 10,
      currentPage: 1,
      totalONE: 0,

      currentPageONE: 1,
      isSearch: false,
      // edit
      editTiele: '',
      editDialogStatus: false,
      addDialogStatus: false,
      addDialogStatus2: false,
      editProjectIdentifyInput: '',
      editProjectInput: '',
      from: {},
      from2: { cwxl: 0 },

      serchFrom: {
        sosuo: '',
      },
    }
  },

  mounted() {
    // this.getProjectListApi();

    for (let i = 0; i < 3; i++) {
      this.renderData.push({
        bdmc: '成都13号线1标项目',
        pbbm: 'CLRO=00' + i,
        pbmc: '0' + i,
        glcz: '成都13号线物资总仓',
        xzsj: '2023-06-19 12:00:12',
        xzyh: i + 1 + '标物资管理员',
      })
    }
    for (let i = 0; i < 3; i++) {
      this.renderDataTow.push({
        clbm: '0000' + (i + 1),
        clmc: '小石' + i,
        ggxh: '1',
        czclmc: '石子',
        sdbl: i * 300 + 200,
        hsl: '1',
      })
    }
    for (let i = 0; i < 3; i++) {
      this.renderDataThree.push({
        cllx: '钢筋',
        ppmc: 'CLKR-00' + i,
        clmc: '0' + i,
        clbm: '0' + i,
        ggxh: '1',
        dw: '吨',
        dj: '1000',
        md: '50',
        shl: '9',
        hs: '否',
        bhz: '否',
        bz: '',
      })
    }
    for (let i = 0; i < 4; i++) {
      this.renderDataFour.push({
        cwmc: '成都中铁二院',
        cllx: '钢筋',
        clmc: '钢筋',
        gg: '1',
        cwlx: '堆料',
        cwxh: i + 1,
        cwbh: '01',
        cjzl: i + 1,
        cjtj: (i + 1) * 100,
        cjsj: '2023-06-19 12:00:12',
        wgdz: '225,225,225,225',
        wgid: '114,114,114,114',
        md: '100',
        ztj: i + 55,
      })
    }
  },

  methods: {
    getSummaries(param) {
      const { columns, data } = param
      console.log(columns)
      const sums = []
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计'
          return
        }
        const values = data.map((item) => {
          console.log(column.property)
          if (
            column.property != 'heqj' &&
            column.property != 'lcmc' &&
            column.property != 'gg' &&
            column.property != 'dw' &&
            column.property != 'clmc'
          ) {
            return Number(item[column.property])
          }
        })

        if (!values.every((value) => isNaN(value))) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr)

            if (!isNaN(value)) {
              return prev + curr
            } else {
              return prev
            }
          }, 0)
          sums[index] += ''
        } else {
          sums[index] = ''
        }
      })

      return sums
    },
    // 搜索
    searchHandler() {
      this.isSearch = true
      if (this.projectInput === '') {
        this.$message({
          message: '请输入查询条件',
          type: 'warning',
        })
      } else {
        // this.getProjectListApi(1, this.pageSize, this.projectInput);
      }
    },
    // 重置
    resetHandler() {
      this.getProjectListApi()
      this.projectInput = ''
      this.isSearch = false
    },

    shuaxin() {
      // this.getProjectListApi();
      // this.projectInput = "";
      // this.isSearch = false;
    },
    // 新增
    addHandler() {
      this.editTiele = '新增'
      this.editDialogStatus = true
      this.editProjectIdentifyInput = ''
      this.editProjectInput = ''
    },
    addHandler2() {
      this.editTiele = '新增'
      this.addDialogStatus2 = true
      this.editProjectIdentifyInput = ''
      this.editProjectInput = ''
    },
    //   编辑
    editHandler(v) {
      this.editTiele = '编辑'
      this.editDialogStatus = true
      this.from = v
    },
    // 删除
    deleteHandler(v) {
      console.log('delete::: ', v)
      this.$confirm('此操作将永久删除该信息?', '提示', {
        confirmButtonText: '确定删除',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          //   this.deleteProjectApi([v.id]);
          this.renderData = this.renderData.filter((ele) => {
            var flag = false
            // 如果不一致，则保留该行
            for (const key in v) {
              if (ele[key] != v[key]) {
                flag = true
                break
              }
            }
            return flag
          })
          this.$message.success('删除成功')
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除',
          })
        })
    },
    deleteManage() {},
    // 每页几条
    handleSizeChange(v) {
      this.pageSize = v
      this.currentPage = 1
      if (this.isSearch === true) {
        // this.getProjectListApi(1, v, this.projectInput);
      } else {
        // this.getProjectListApi(1, v);
      }
    },
    // 分页
    handleCurrentChange(v) {
      this.currentPage = v
      if (this.isSearch === true) {
        // this.getProjectListApi(v, this.pageSize, this.projectInput);
      } else {
        // this.getProjectListApi(v, this.pageSize);
      }
    },
    handleSizeChangeONE(v) {
      this.pageSize = v
      this.currentPage = 1
      if (this.isSearch === true) {
        // this.getProjectListApi(1, v, this.projectInput);
      } else {
        // this.getProjectListApi(1, v);
      }
    },
    // 分页
    handleCurrentChangeONE(v) {
      this.currentPage = v
      if (this.isSearch === true) {
        // this.getProjectListApi(v, this.pageSize, this.projectInput);
      } else {
        // this.getProjectListApi(v, this.pageSize);
      }
    },
    // editDialog保存
    editSaveHandler() {
      this.editDialogStatus = false
      let params = {
        mark: this.editProjectIdentifyInput,
        name: this.editProjectInput,
      }

      if (this.editTiele == '新增') {
        this.addProjectApi(params)
      } else {
        this.updateProjectApi(params)
      }
    },

    /**接口 */
    // 查询项目列表
    getProjectListApi(pageNum = 1, pageSize = 10, name = '') {
      let params = {
        pageNum,
        pageSize,
        name,
      }

      console.log(params)

      //   getProjectList(params).then((res) => {
      //     if (res.code == 200) {
      //       this.renderData = res.data.records;
      //       this.total = res.data.total;
      //       this.pageSize = res.data.size;
      //     }
      //   });
    },
    // 项目详情
    projectDetailApi(params) {
      console.log(params)
      //   projectDetail(params).then((res) => {
      //     console.log("res::: ", res);
      //   });
    },
    // 新增项目
    addProjectApi(params) {
      console.log(params)

      this.renderData.push({
        bdmc: '成都13号线1标项目',
        pbbm: 'CLRO=00',
        pbmc: '0',
        glcz: '成都13号线物资总仓',
        xzsj: '2023-06-19 12:00:12',
        xzyh: '1标物资管理员',
      })

      //   addProject(params).then((res) => {
      //     if (res.code == 200) {
      //       let pgn =
      //         Number.isInteger(this.total / this.pageSize) == true
      //           ? this.total / this.pageSize + 1
      //           : Math.ceil(this.total / this.pageSize);
      //       this.getProjectListApi(pgn, this.pageSize);
      //       this.$message.success("新增成功");
      //     } else {
      //       this.$message.error("新增失败");
      //     }
      //   });
    },
    // 编辑项目
    updateProjectApi(params) {
      console.log(params)
      //   updateProject(params).then((res) => {
      //     if (res.code == 200) {
      //       this.getProjectListApi(this.currentPage, this.pageSize);
      //       this.$message.success("编辑成功");
      //     } else {
      //       this.$message.error(res.message);
      //     }
      //   });
    },
    // 删除项目
    deleteProjectApi(idList = '') {
      let params = { idList }
      console.log(params)
      //   deleteProject(params).then((res) => {
      //     let pgn =
      //       Number.isInteger(this.total / this.pageSize) == true
      //         ? this.total / this.pageSize + 1
      //         : Math.ceil(this.total / this.pageSize);
      //     if (res.code == 200 && this.search === true) {
      //       this.getProjectListApi(pgn, this.pageSize, this.projectInput);
      //       this.$message.success("删除成功");
      //     } else if (res.code == 200 && this.search === false) {
      //       this.getProjectListApi(pgn, this.pageSize);
      //       this.$message.success("删除成功");
      //     } else {
      //       this.$message.error(res.message);
      //     }
      //   });
    },
  },
}
</script>

<style lang="less" scoped>
#warehouseInform {
  width: 95%;
  margin: 0 auto;
  margin-top: 1rem;
  .addsiloScan {
    .el-form-item {
      margin-bottom: 10px;
    }
  }
  .warehouseInformH1 {
    display: inline-block;
    margin: 1rem 0;
    border-bottom: 3px solid #409eff;
    padding-bottom: 10px;
    color: #409eff;
    font-size: 22px;
  }
  .pagination {
    position: relative;
    .warehouseInformpagination1 {
      position: absolute;
      bottom: -20px;
      right: -5px;
    }
  }
}
.el-date-editor {
  margin: 0 10px;
}
.imgBox {
  position: relative;
  top: 0;
  left: 0;
  .uploadImg {
    position: absolute;
    top: 30%;
    left: 30%;
    visibility: hidden;
  }
}
.imgBox:hover .uploadImg {
  visibility: visible;
}
:deep(.el-dialog__header) {
  background-color: rgb(43, 43, 53);
}
:deep(.el-dialog__title) {
  color: #fff;
}
// 图片上传
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
.pDiv {
  background-color: #f5f7fa;
  color: #909399;
  border: 1px solid #dcdfe6;
  border-right: 0px;
  border-radius: 4px 0 0 4px;
  text-align: center;
  height: 40px;
  line-height: 40px;
  width: 13.7%;
}
:deep(.pSelect) {
  .el-input__inner {
    border-radius: 0 4px 4px 0;
    width: 107.5%;
  }
  .el-input__suffix {
    right: -5%;
  }
}
.mgb-10 {
  margin-bottom: 5px;
}
</style>
